// http://poj.org/problem?id=1521

#include <iostream>
#include <vector>
#include <queue>
#include <string>
using namespace std;

void run(string message) {
    vector<int> charCount(27);
    for (int i = 0; i < message.size(); ++i) {
        if (message[i] == '_') {
            ++charCount[26];
        } else {
            ++charCount[message[i] - 'A'];
        }
    }

    int cnt = message.size();
    int ans1 = 8 * cnt;

    priority_queue<int, vector<int>, greater<int> > Q;
    for (int i = 0; i < charCount.size(); ++i) {
        if (charCount[i] > 0) {
            Q.push(charCount[i]);
        }
    }

    int ans2 = cnt;
    while (Q.size() > 2) {
        const int c1 = Q.top();     Q.pop();
        const int c2 = Q.top();     Q.pop();
        const int c3 = c1 + c2;     ans2 += c3;
        Q.push(c3);
    }

    printf("%d %d %.1lf\n", ans1, ans2, (double)ans1 / (double) ans2);
}

int main() {
    string message;
    cin >> message;
    while (message != "END") {
        run(message);
        cin >> message;
    }
    return 0;
}